#pragma once

#include <vtkm/worklet/WorkletMapField.h>

class Parameter;
using vtkm::worklet::WorkletMapField;
using vtkm::Id;

struct SetValue : public WorkletMapField
{
	using ControlSignature = void(FieldInOut);
	using ExecutionSignature = void(_1);

	template<typename T>
	VTKM_EXEC
		void operator()(T& in) const
	{
		in = 1.02;
	}
};

struct Performance : public WorkletMapField
{
	using ControlSignature = void(FieldIn, FieldOut);
	using ExecutionSignature = void(WorkIndex, _1, _2);

	VTKM_CONT
		Performance(Id num):
		num_iters(num)
	{

	}
	template<typename T>
	VTKM_EXEC
	void operator()(const Id& idx, const T& in, T& out) const
	{
		//auto _id = idx;
		for (Id i = 0; i < num_iters; i++)
		{
			out = vtkm::Log2(in + out);
			//out = vtkm::Sin(in + out);
			//out = in * (in+1.031) + out *1.1f;// +_id;
		}
	}
	Id num_iters;
};

void run(Parameter& p);